<template>
    <div id="myInfo">
        <div>
            <van-nav-bar
                    title="用户信息"
                    left-text="返回"
                    left-arrow
                    @click-left="onClickLeft"
            />
        </div>


        <div>
            <van-cell-group style="margin-top: 0.6rem">
                <van-cell title="头像" center is-link>
                    <van-image
                            round
                            width="4rem"
                            height="4rem"
                            :src="(this.$route.query.headImage === null )? require('../images/cat.jpeg'):baseURL1+this.$route.query.headImage"
                    />
                </van-cell>
<!--              @click="$router.push({path:'/dashboard/mine/myCoupons'})"-->
                <van-cell title="昵称" :value="this.$route.query.userName" is-link   />

                <van-cell is-link title="性别" :value="sex" @click="show = true" />
                <van-action-sheet v-model="show" cancel-text="取消" :actions="actions" @select="onSelect" />

                <van-cell title="手机" :value="this.$route.query.phone" is-link   />

                <van-cell title="实名认证" value="未填写" is-link  />

            </van-cell-group>

        </div>



    </div>

</template>

<script>
    import { Toast } from 'vant';
    import img from "@/api/api"
    export default {
        name: "MyInfo",
        data() {
            return {
                show: false,
                birthday: false,
                actions: [{ name: '男' }, { name: '女' }],
                minDate: new Date(1900, 0, 1),
                maxDate: new Date(2025, 10, 1),
                currentDate: new Date(2021, 0, 17),
              baseURL1:img.src,
              sex:this.$route.query.sex === '1' ? '男':'女'
            };
        },
        methods: {

            onClickLeft() { // 点击左边
                this.$router.back();  // 返回上一个路由
            },
            showPopup() {
                this.show = true;
            },
            onCancel() {
                Toast('取消');
            },
            onSelect(item) {
                // 默认情况下点击选项时不会自动收起
                // 可以通过 close-on-click-action 属性开启自动收起
                this.sex = item.name;
                this.show = false;
                Toast(item.name);
            },
            exit(){

                this.birthday = false;

            },


        },
    }
</script>

<style scoped>
    #myInfo {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #f5f5f5;
        z-index: 9999;
    }


</style>